<?php

namespace polymerize\user\module\user;


use app\common\InstanceTrait;
use app\model\UserToken;
use support\Redis;

class OutLogin
{
    use InstanceTrait;

    /**
     * 退出登录
     *
     * @param int    $uid
     * @param string $token
     * @return bool
     */
    public function outLogin(int $uid, string $token): bool
    {
        Redis::set(APP_TOKEN_LOGIN . $token, [], 'EX', 1, 1);

        return UserToken::where('uid', $uid)->delete();
    }
}
